/*
 * Author: Karthic Kumar
 */

package sg.edu.nus.iss.team4ft.service;

import java.io.Serializable;

import java.util.*;


public class Call  implements Serializable  {

	private static final long serialVersionUID = 1L;
	private String accountNumber;
	private Long telephoneNumber;
	private String calledNumber;

	private FeatureCode callType;
	private int numberCalled;
	private Date timeOfCall;
	private int durationOfCallInSeconds;
	private Double chargePerUnit = 0.0;	
	
	public Call(){
	}
	
	public Call(Integer numberCalled, Date timeOfCall, Integer durationOfCallInSeconds, Double chargePerUnit,Long telephoneNumber ){
		setNumberCalled(numberCalled);
		setTimeOfCall(timeOfCall);
		setDurationOfCallInSeconds(durationOfCallInSeconds);
		setChargePerUnit(chargePerUnit);
		setTelephoneNumber(telephoneNumber);
	}
	
	public Double getChargePerUnit() {
		return chargePerUnit;
	}
	
	public void setChargePerUnit(Double chargePerUnit) {
		this.chargePerUnit = chargePerUnit;
	}
	
	public Integer getDurationOfCallInSeconds() {
		return durationOfCallInSeconds;
	}
	
	public void setDurationOfCallInSeconds(int durationOfCallInSeconds) {
		this.durationOfCallInSeconds = durationOfCallInSeconds;
	}
	
	public Integer getNumberCalled() {
		return numberCalled;
	}
	
	public void setNumberCalled(Integer numberCalled) {
		this.numberCalled = numberCalled;
	}
	
	public Date getTimeOfCall() {
		return timeOfCall;
	}
	
	public void setTimeOfCall(Date timeOfCall) {
		this.timeOfCall = timeOfCall;
	}
	
	public Double calculateCallCharge()
	{
		return durationOfCallInSeconds * chargePerUnit;
	}
	
	@SuppressWarnings("deprecation")
	public boolean canInclude(Date forDate){
		if(timeOfCall.getMonth() == forDate.getMonth() && timeOfCall.getYear() == forDate.getYear())
			return true;
		else
			return false;			
	}

	public String getAccountNumber() {
		return accountNumber;
	}

	public void setAccountNumber(String accountNumber) {
		this.accountNumber = accountNumber;
	}

	public String getCalledNumber() {
		return calledNumber;
	}

	public void setCalledNumber(String phoneNumber) {
		this.calledNumber = phoneNumber;
	}

	public FeatureCode getCallType() {
		return callType;
	}

	public void setCallType(FeatureCode callType) {
		this.callType = callType;
	}

	public Long getTelephoneNumber() {
		return telephoneNumber;
	}

	public void setTelephoneNumber(Long telephoneNumber) {
		this.telephoneNumber = telephoneNumber;
	}
}
